<?php
/*
 *      vuvuzela.php
 *      
 *      Copyright 2010 Nguyễn Hồng Quân <ng.hong.quan@gmail.com>
 *      
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *      
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *      
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 * 
 */

require_once 'inc/magpierss/rss_fetch.inc';

define('MAGPIE_INPUT_ENCODING', 'UTF-8');
define('MAGPIE_OUTPUT_ENCODING', 'UTF-8');

$rss = fetch_rss('http://www.theoyeucau.com/Home/Onair/Quick_Snow_Show/RSS/');
echo "<?xml version='1.0' encoding='UTF-8'?>\n";
?>
<rss version='2.0'>
<channel>
	<title><?=$rss->channel['title']?></title>
	<link><?=$rss->channel['link']?></link>
	<description><?=$rss->channel['description']?></description>
	<language>vi</language>
	<copyright><?=$rss->channel['copyright']?></copyright>
	<lastBuildDate><?=$rss->last_modified?></lastBuildDate>
	<webMaster>quicksnowshow@gmail.com</webMaster>
<?php
	//print_r($rss->items[0]);
	for ($i = 0; $i < 2; $i++) {
		$group = $rss->items[$i];
		$trimpos = strpos($group['description'], '<p>');
		$txt = substr($group['description'], 0, $trimpos);
		$list = new SimpleXMLElement($txt);
		foreach ($list->li as $it) {
			$flink = $it->a['href'].'Download/';
			$title = $it->a;
?>
		<item>
			<title><?=$title?></title>
			<link><?=$flink?></link>
			<guid><?=$flink?></guid>
			<description> Welcome to the show it is March 25th and this is our 138th show.  Today will be an interview with Bruce Murray from the Zedcast podcast. Please visit this podcast at http://www.zedcast.com/ </description>
			<enclosure url='<?=$flink?>' type='audio/mpeg'/>
			<category>Podcasts</category>
			<pubDate><?=$group['pubdate']?></pubDate>
		</item>
<?php
		}
	}
?>
</channel>
</rss>
